package com.micro.service.controller;

import com.micro.service.annotation.ApiVersion;
import com.micro.service.entity.ResponseMessage;
import com.micro.service.model.ConfigInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 从config-server中获取配置信息
 */
@RestController
@ApiVersion(1)
@RequestMapping("{version}/config/info")
@RefreshScope
public class ConfigInfoController {

    @Autowired
    private ConfigInfo configInfo;

    @GetMapping(produces = {"application/json;charset=UTF-8"})
    public ResponseMessage<ConfigInfo> getConfigInfo() {
        return ResponseMessage.success(configInfo);
    }
}
